from dto.strategy_assessment import RiskAssessment
from dto.strategy_calculate_result import StrategyCalculateResult
from service.das.stock_assessment_das import RiskAssessmentService
from service.das.stock_assessment_item_das import (
    AntRiskAssessmentItem,
    RiskAssessmentItemService,
)
from service.das.stock_monitor_das import AntMonitorStock


class StrategyViewQueryService:

    def searchFinalResult(self, stockInfo: AntMonitorStock) -> StrategyCalculateResult:
        """
        聚合查询，返回 StrategyCalculateResult 对象
        :param stock_code: 股票代码
        :return: 聚合的 StrategyCalculateResult
        """
        try:

            riskService = RiskAssessmentService()
            riskItem = RiskAssessmentItemService()
            stock_code = stockInfo.stock_code

            # 查询 AntRiskAssessmentModel 的股票信息

            stock_record = riskService.get_risk_assessment_by_code(stock_code)
            risk_items = riskItem.query_risk_assessment_items_by_code(stock_code)

            # 聚合结果
            result = StrategyCalculateResult()
            return result
        except Exception as e:
            print(f"查询时出错: {e}")
            return StrategyCalculateResult()
